package com.tianya.config;

import com.tianya.interceptors.InterceptorHandle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web 配置类
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private InterceptorHandle interceptorHandle;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器，并指定拦截路径
//        String[] swaggerExcludes=new String[]{"/swagger-ui.html","/swagger-resources/**","/webjars/**"};
//        registry.addInterceptor(interceptorHandle)
//                .addPathPatterns("/**") // 拦截所有路径
//                .excludePathPatterns("/user/login", "/user/register")
//                .excludePathPatterns(swaggerExcludes);// 排除登录和注册路
    }
}